<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="d" uri="http://dgg.net/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>证书信息列表</title>
</head>
<body class="body-main">
<div class="titleSearch1">
    <form id="titleSearch1">
        <div class="layui-inline">
            <div class="layui-inline">
                <label>签单商务：</label>
                <div class="layui-input-inline">
                    <input type="text" class="input-style win100" id="signUserName" name="signUserName"/>
                </div>
            </div>
            <div class="layui-inline">
                <label>客户信息：</label>
                <div class="layui-input-inline">
                    <input type="text" class="input-style win250" id="customerName" name="customerName"/>
                </div>
            </div>
            <div class="layui-inline">
                <label>订单信息：</label>
                <div class="layui-input-inline">
                    <input type="text" class="input-style win250" placeholder="订单编号/合同编号" id="keywords" name="keywords"/>
                </div>
            </div>
            <input type="hidden" name="id" value="${id}"/>
        </div>
    </form>
    <div class="layui-inline">
        <button class="layui-btn layui-btn-mini layui-btn-normal" onclick="search('#myTable1','reload')">搜索</button>
        <button class="layui-btn layui-btn-mini layui-btn-primary" onclick="cleanSearchWithHidden()">清空</button>
    </div>
</div>

<table id="myTable1" class="cell-border crm-table">
</table>
<script src="${rootUrl}/static/js/zzsc/credential/credentailCommon/credentailCommon.js?v=${version}"></script>
<script src="${rootUrl}/static/js/zzsc/credential/waitCredential/addCredential.js?v=${version}"></script>
<script>
    $(function () {
        $('#myTable1').dataTableExtend({
            "ajax": {
                "url": "${rootUrl}/zs/general_credential/wait_add_data.do",
                "type": "post"
            }, "fnServerParams": function (aoData) {
                aoData = $.extend(aoData, $('.titleSearch1').serialize2object());
                return aoData;
            },
            "pageLength": 5,//每页显示的条数默认是10条，有特殊业务需要显示不同条数的列表才应该加入该参数
            "aoColumns": [
                {
                    "title": '<input type="checkbox" class="checkall"/>',
                    "sClass": "check-th",
                    "orderable": false,
                    "data": "productId",
                    "render": function (data, type, full, meta) {
                        return '<input type="checkbox"  class="checkchild"  value="' + data + '" />';
                    }
                },
                {
                    "title": "序号",
                    "orderable": false,
                    "render": function (data, type, full, meta) {
                        return meta.row + 1;
                    }
                },
                {
                    "title": "所属事业部",
                    "data": "productOrgName",
                    "orderable": false
                },
                {
                    "title": "订单编号",
                    "data": "orderBusinessNo",
                    "orderable": false
                },
                {
                    "title": "客户",
                    "data": "customerPhone",
                    "orderable": false,
                    "render": function (data, type, row, meta) {
                        return row.customerName + "<br/>" + (!checkIsEmpty(row.customerPhone) ? hidePhone(row.customerPhone) : "");
                    }
                },
                {
                    "title": "产品",
                    "data": "productName",
                    "orderable": false,
                },
                {
                    "title":
                        "签单商务",
                    "data":
                        "signUserName",
                    "orderable":
                        false
                }
                ,
                {
                    "title":
                        "合同编号",
                    "data":
                        "contractNo",
                    "orderable":
                        false
                }
                ,
                {
                    "title":
                        "签单时间",
                    "data":
                        "orderTime",
                    "orderable":
                        true,
                    "render":

                        function (data, type, row, meta) {
                            return data;
                        }
                }
            ]
        });
    });
    function confirmAffiliated1(talentRenewal) {
        var ids = getTableSelect("#myTable1");
        var id = $("input[name=id]").val();
        if (ids.length == 0) {
            DGG.Warning('请选择使用证书!');
            return false;
        }
        if (ids.length > 1) {
            DGG.Warning('只能选择单个证书进行使用!');
            return false;
        }
        DGG.loading()
        $.post(sysInfo.basePath + '/zs/general_credential/add_certificate_check1.do', {productId: ids[0]}, function (result) {
            if (result.code == 0) {
                editCretificate(id,ids[0],talentRenewal);
            } else {
                DGG.Errors(result.msg);
            }
        }, 'json');
    }
    // 清空搜索
    function cleanSearchWithHidden() {
        var $s = $('.titleSearch1');
        $s.find('input').val('');
        $s.find('select').val('');
        $s.find('select').val('').trigger("change");
        $s.find('input').attr("data-id", '');
        $.each($s.find("input[type=hidden]"), function (i, v) {
            $(this).val('');
        });
    }
</script>
</body>
</html>